| Shawn O. Pearce | 6e75221 | 2009-08-12 12:22:12 -0700 | [diff] [blame] | 1 | gerrit create-project |
| 2 | ===================== |
| 3 | |
| 4 | NAME |
| 5 | ---- |
| 6 | gerrit create-project - Create a new hosted project |
| 7 | |
| 8 | SYNOPSIS |
| 9 | -------- |
| 10 | [verse] |
| 11 | 'ssh' -p <port> <host> 'gerrit create-project' \ |
| 12 | \--name <NAME> \ |
| 13 | [\--owner <OWNER>] \ |
| 14 | [\--description <DESC>] \ |
| 15 | [\--submit-type <TYPE>] \ |
| 16 | [\--use-contributor-agreements {true|false}] \ |
| 17 | [\--use-signed-off-by {true|false}] |
| 18 | |
| 19 | DESCRIPTION |
| 20 | ----------- |
| 21 | Creates a new bare Git repository under `gerrit.basePath`, using |
| 22 | the project name supplied. The newly created repository is empty |
| 23 | (has no commits), but is registered in the Gerrit database so that |
| 24 | the initial commit may be uploaded for review, or initial content |
| 25 | can be pushed directly into a branch. |
| 26 | |
| 27 | If replication is enabled, this command also connects to each of |
| 28 | the configured remote systems over SSH and uses command line git |
| 29 | on the remote system to create the empty repository. |
| 30 | |
| 31 | |
| 32 | ACCESS |
| 33 | ------ |
| 34 | Caller must be a member of the privileged 'Administrators' group. |
| 35 | |
| 36 | SCRIPTING |
| 37 | --------- |
| 38 | This command is intended to be used in scripts. |
| 39 | |
| 40 | OPTIONS |
| 41 | ------- |
| 42 | \--name:: |
| 43 | Required; name of the project to create. If name ends with |
| 44 | `.git` the suffix will be automatically removed. |
| 45 | |
| 46 | \--owner:: |
| 47 | Name of the group which will initially own this repository. |
| 48 | The specified group must already be defined within Gerrit. |
| 49 | Only one group can be specified on the command line. |
| 50 | To specify additional owners, add the additional owners |
| 51 | through the web interface after project creation. |
| 52 | + |
| 53 | Defaults to `Administrators` if not specified. |
| 54 | |
| 55 | \--description:: |
| 56 | Initial description of the project. If not specified, |
| 57 | no description is stored. |
| Shawn O. Pearce | ea6fc17 | 2009-09-18 15:40:38 -0700 | [diff] [blame] | 58 | + |
| 59 | Description values containing spaces should be quoted in single quotes |
| 60 | (\'). This most likely requires double quoting the value, for example |
| 61 | `\--description "\'A description string\'"`. |
| Shawn O. Pearce | 6e75221 | 2009-08-12 12:22:12 -0700 | [diff] [blame] | 62 | |
| 63 | \--submit-type:: |
| 64 | Action used by Gerrit to submit an approved change to its |
| 65 | destination branch. Supported options are: |
| 66 | + |
| 67 | * fast-forward-only: produces a strictly linear history. |
| 68 | * merge-if-necessary: create a merge commit when required. |
| 69 | * merge-always: always create a merge commit. |
| 70 | * cherry-pick: always cherry-pick the commit. |
| 71 | |
| 72 | + |
| 73 | Defaults to fast-forward-only. For more details see |
| 74 | link:project-setup.html#submit_type[Change Submit Actions]. |
| 75 | |
| 76 | \--use-contributor-agreements:: |
| 77 | If enabled, authors must complete a contributor agreement |
| 78 | on the site before pushing any commits or changes to this |
| 79 | project. Disabled by default. |
| 80 | |
| 81 | \--use-signed-off-by:: |
| 82 | If enabled, each change must contain a Signed-off-by line |
| 83 | from either the author or the uploader in the commit message. |
| 84 | Disabled by default. |
| 85 | |
| 86 | |
| 87 | EXAMPLES |
| 88 | -------- |
| 89 | Create a new project called `tools/gerrit`: |
| 90 | |
| 91 | ==== |
| 92 | $ ssh -p 29418 review.example.com gerrit create-project --name tools/gerrit.git |
| 93 | ==== |
| 94 | |
| Shawn O. Pearce | ea6fc17 | 2009-09-18 15:40:38 -0700 | [diff] [blame] | 95 | Create a new project with a description: |
| 96 | |
| 97 | ==== |
| 98 | $ ssh -p 29418 review.example.com gerrit create-project --name tool.git --description "'Tools used by build system'" |
| 99 | ==== |
| 100 | |
| 101 | Note that it is necessary to quote the description twice. The local |
| 102 | shell needs double quotes around the value to ensure the single quotes |
| 103 | are passed through SSH as-is to the remote Gerrit server, which uses |
| 104 | the single quotes to delimit the value. |
| 105 | |
| Shawn O. Pearce | 6e75221 | 2009-08-12 12:22:12 -0700 | [diff] [blame] | 106 | REPLICATION |
| 107 | ----------- |
| 108 | The remote repository creation is performed by a Bourne shell script: |
| 109 | |
| 110 | ==== |
| 111 | mkdir -p '/base/project.git' && cd '/base/project.git' && git init --bare |
| 112 | ==== |
| 113 | |
| 114 | For this to work successfully the remote system must be able to |
| 115 | run arbitrary shell scripts, and must have `git` in the user's PATH |
| 116 | environment variable. Administrators can run this command by hand |
| 117 | to establish a new empty repository if necessary. |
| 118 | |
| 119 | SEE ALSO |
| 120 | -------- |
| 121 | |
| 122 | * link:config-replication.html[Git Replication/Mirroring] |
| 123 | * link:project-setup.html[Project Setup] |
| 124 | |
| 125 | GERRIT |
| 126 | ------ |
| 127 | Part of link:index.html[Gerrit Code Review] |